CSharpTest.Net
CreateFile Property
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTreeOptions<TKey,TValue> Class : CreateFile Property

Glossary Item Box

Gets or sets the file-create policy used when backing with a file storage

Syntax

Visual Basic (Declaration) 
Public Property CreateFile As CreatePolicy
C# 
public CreatePolicy CreateFile {get; set;}

Example

BPlusTree/BPlusTree.Test/ThreadedMassInsertTest.cs

C#Copy Code
mreStop.Reset();
using(TempFile temp = new TempFile())
{
    BPlusTree<Guid, TestInfo>.OptionsV2 options = new BPlusTree<Guid, TestInfo>.OptionsV2(
        PrimitiveSerializer.Guid, new TestInfoSerializer());
    options.CalcBTreeOrder(16, 24);
    options.CreateFile = CreatePolicy.Always;
    options.FileName = temp.TempPath;
    using (BPlusTree<Guid, TestInfo> tree = new BPlusTree<Guid, TestInfo>(options))
    {
        tree.EnableCount();
        var actions = new List<IAsyncResult>();
        var tests = new Action<BPlusTree<Guid, TestInfo>>[] 
        {
            DeleteStuff, UpdateStuff, AddStuff, AddRanges, BulkyInserts,
            FetchStuff, FetchStuff, FetchStuff, FetchStuff, FetchStuff
        };

        foreach (var t in tests)
            actions.Add(t.BeginInvoke(tree, null, null));

        do
        {
            Trace.TraceInformation("Dictionary.Count = {0}", tree.Count);
            Thread.Sleep(1000);
        } while (Debugger.IsAttached);

        mreStop.Set();
        for (int i = 0; i < actions.Count; i++)
        {
            tests[i].EndInvoke(actions[i]);
        }

        Trace.TraceInformation("Dictionary.Count = {0}", tree.Count);
    }
}
VB.NETCopy Code
mreStop.Reset()
Using temp As New TempFile()
    Dim options As New BPlusTree(Of Guid, TestInfo).OptionsV2(PrimitiveSerializer.Guid, New TestInfoSerializer())
    options.CalcBTreeOrder(16, 24)
    options.CreateFile = CreatePolicy.Always
    options.FileName = temp.TempPath
    Using tree As New BPlusTree(Of Guid, TestInfo)(options)
        tree.EnableCount()
        Dim actions As var = New List(Of IAsyncResult)()
        Dim tests As var = New Action(Of BPlusTree(Of Guid, TestInfo))() {DeleteStuff, UpdateStuff, AddStuff, AddRanges, BulkyInserts, FetchStuff, _
            FetchStuff, FetchStuff, FetchStuff, FetchStuff}

        For Each t As var In tests
            actions.Add(t.BeginInvoke(tree, Nothing, Nothing))
        Next

        Do
            Trace.TraceInformation("Dictionary.Count = {0}", tree.Count)
            Thread.Sleep(1000)
        Loop While Debugger.IsAttached

        mreStop.[Set]()
        Dim i As Integer = 0
        While i < actions.Count
            tests(i).EndInvoke(actions(i))
            System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
        End While

        Trace.TraceInformation("Dictionary.Count = {0}", tree.Count)
    End Using
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys